import { defHttp } from '/@/utils/http/axios';
import setting from '/@/settings/projectSetting';
import { ContentTypeEnum } from '/@/enums/httpEnum';

const Api = {
  getCtlHtmlForQuery: `${setting.interfacePrefix}/public/getCtlHtmlForQuery`, // 根据表单字段获取宏控件
  convertModuleFieldSelectDesc: `${setting.interfacePrefix}/flow/macro/convertModuleFieldSelectDesc`, // 将新版表单域选择宏控件属性对话框中的json生成为desc
  convertModuleFieldSelectDescRevise: `${setting.interfacePrefix}/flow/macro/convertModuleFieldSelectDescRevise`, // 将desc转换为新版表单域选择宏控件属性对话框中的json

  convertNestSheetDesc: `${setting.interfacePrefix}/flow/macro/convertNestSheetDesc`, // 将新版嵌套表宏控件属性对话框中的json生成为desc
  convertNestSheetDescRevise: `${setting.interfacePrefix}/flow/macro/convertNestSheetDescRevise`, // 将desc转换为新版嵌套表宏控件属性对话框中的json

  getIconSymbolList: `${setting.interfacePrefix}/flow/macro/getIconSymbolList`, // 取得图标宏控件的图标列表
};

export const getCtlHtmlForQuery = (params?: any) =>
  defHttp.post<any>(
    {
      url: Api.getCtlHtmlForQuery,
      params,
    },
    {
      isTransformResponse: false,
    },
  );

export const convertModuleFieldSelectDesc = (params?: any) =>
  defHttp.post<any>({
    url: Api.convertModuleFieldSelectDesc,
    params,
    headers: { 'Content-Type': ContentTypeEnum.JSON },
  });

export const convertModuleFieldSelectDescRevise = (params?: any) =>
  defHttp.post<any>({
    url: Api.convertModuleFieldSelectDescRevise,
    params,
  });

export const convertNestSheetDesc = (params?: any) =>
  defHttp.post<any>({
    url: Api.convertNestSheetDesc,
    params,
    headers: { 'Content-Type': ContentTypeEnum.JSON },
  });

export const convertNestSheetDescRevise = (params?: any) =>
  defHttp.post<any>({
    url: Api.convertNestSheetDescRevise,
    params,
  });

export const getIconSymbolList = (params?: any) =>
  defHttp.post<any>({
    url: Api.getIconSymbolList,
    params,
  });
